package vt100console;


import java.io.*;
public class Console
{

	BufferedReader cin;
	PrintStream cout;
	public Console(InputStream in, PrintStream out)
	{				
		cin = new BufferedReader(new InputStreamReader(in));
		cout = out;		
	}
	public void print(String output, int vt100cmd)
	{
		output = format(output, vt100cmd);
		cout.print(output);
	}
	public void println(String output, int vt100cmd)
	{
		output = format(output, vt100cmd);
		cout.println(output);
	}
	public String format(String output, int vt100cmd)
	{
		if(System.getProperty("os.name").contains("Windows"))
			return output;
		output = "\033[" + vt100cmd + "m" + output + "\033[m";
		return output;
	}
	public String readLine() throws IOException
	{
		return cin.readLine();
	}
	public void cls() throws IOException
	{
		if(System.getProperty("os.name").contains("Windows"))
		{			
			for(int i = 0; i < 25; i++)
				cout.println();
		}
		else
			cout.println(((char) 27)+"[2J");
	}
}
